package com.yinhai.contacts.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.yinhai.activity.R;
import com.yinhai.contacts.bean.SameRecord;

public class ContactsSameListSubAdapter extends BaseAdapter {
	//private Context ctx;
	private LayoutInflater inflater;
	List<SameRecord> list;
	SameRecord selectCn;
	Context context;
	public ContactsSameListSubAdapter(Context context, List<SameRecord> list) {
		this.context = context;
		this.list = list;
		this.inflater = LayoutInflater.from(context);
	}
	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		convertView = inflater.inflate(R.layout.samecontact_list_subitem, null);
		holder = new ViewHolder();
		holder.name = (TextView) convertView.findViewById(R.id.dial_item_name);
		holder.tel = (TextView) convertView.findViewById(R.id.dial_item_tel);
		convertView.setTag(holder);
		SameRecord selectCn = list.get(position);
		holder.name.setText(selectCn.getMomeItem());
		holder.tel.setText(selectCn.getSameItem());
		
		return convertView;
	}

	public static class ViewHolder {
		TextView name;
		TextView tel;
	}

}
